/*
 *  CS202 - Spring 2009">
 *  Professor: Dr. Michael Peterson">
 *  Student: Deylo Woo (dwoo711@gmail.com) ">
 */
package project_3_v_2;

import javax.swing.*;
import java.awt.*;

/**
 * Missile class
 * @author deylo
 */
public class Missile extends MovingObject {

    /**
     * Constructor methods
     */
    public Missile() {
        super();
        setColor(Color.BLACK);
    }

    /**
     * Constructor passing parameter
     * @param xCoord: x coordinate on panel
     * @param yCoord: y coordinate on panel
     * @param height: height of missile
     * @param width: width of missile
     * @param rise: vertical velocity
     * @param run: horizontal velocity
     * @param color: color of missile
     */
    public Missile(int xCoord, int yCoord, int height, int width, int rise, int run, Color color) {
        super(xCoord, yCoord, height, width, rise, run, color);

    }

    /**
     * Move the missile on screen
     * @param pPanelHeight: pass the panel height for dynamic resize of panel
     * @param pPanelWidth: pass the panel width for dynamic resize of panel
     */
    @Override
    public void Move(int pPanelHeight, int pPanelWidth) {
        if (_xCoord < (0 - _run) || _xCoord > (pPanelWidth - _width)) {
            _run = -_run;
        }
        if (_yCoord < (0 - _rise) || _yCoord > (pPanelHeight - _height)) {
            _rise = -_rise;
        }
        _xCoord += _run;
        _yCoord += _rise;
    }
}
